<!DOCTYPE html>
<html lang="en">

<head>
    <title>登录</title>
    <#include "/lx/activity/components/meta.html" />
    <#include "/lx/activity/components/stylesheets.html" />
    <link rel="stylesheet" href="/lx/activity/stylesheets/login.css?v=2">
</head>

<body>
    <div id="app">
        <img src='/lx/activity/assets/img/login-bg.png' class='top-bg'></img>
        <div class='form'>
            <div class='field'>
                <!-- <div class='field-icon'>
                    <img src='/lx/activity/assets/img/location.png'></img>
                </div> -->
                <div class="field-icon2">
                    <i class="am-icon-user"></i>
                </div>
                <input placeholder='请输入手机号 / 邮箱' class='field-input' v-model="account"></input>
            </div>
            <div class='field'>
                <!-- <div class='field-icon'>
                    <img src='/lx/activity/assets/img/location.png'></img>
                </div> -->
                <div class="field-icon2">
                    <i class="am-icon-lock"></i>
                </div>
                <input placeholder='请输入密码' type="password" class='field-input' v-model="password"></input>
            </div>
        </div>
        <div class='submit-wrap'>
            <button class='am-btn am-btn-default submit theme-background-color1' @click="login">登录</button>
        </div>
        <div class='options'>
            <!-- <div class='option' bindtap="loginWithCode">动态码登录</div>
            <div class='option' bindtap="forgetPwd">忘记密码</div> -->
            <div class='option' @click="signUp">注册账号</div>
        </div>
    </div>
    <#include "/lx/activity/components/scripts.html" />
    <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9/crypto-js.min.js"></script> -->
    <script src="//res.zhen-yee.com/assert/crypto-js.3.1.9.min.js"></script>
    <script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data() {
            return {
                account: '',
                password: ''
            }
        },
        mounted: function() {},
        methods: {
            signUp() {
                window.location.href = '/lx/mini/user/valiMobile';
            },
            login() {
                var self = this;
                var url = '/lx/mini/user/login';
                var encoded = self.aesCBC(self.password);
                var params = {
                    account: self.account,
                    password: encoded
                };
                var success = function(res) {
                    window.location.href = '/lx/mini/activity';
                }
                var fail = function() {};
                var complete = function() {};
                request(url, params, success, fail, complete);
            },
            aesCBC(text) {
                var aesText = text;
                var key = CryptoJS.enc.Utf8.parse('liuxue!@#$%^&*()');
                var iv = CryptoJS.enc.Utf8.parse('RandomInitVector');
                aesText = CryptoJS.AES.encrypt(text, key, {
                    iv: iv,
                    mode: CryptoJS.mode.CBC,
                    padding: CryptoJS.pad.Pkcs7
                }).toString();
                return aesText;
            }
        }
    })
    </script>
    <script>
    // wx.ready(function() {
    //     initWXShare()
    // })
    </script>
</body>

</html>